package flow

import kotlinx.coroutines.runBlocking

private fun simple(): Sequence<Int> = sequence {
    for (i in 1..3) {
        Thread.sleep(2000)
        yield(i)
    }
}

fun main(args: Array<String>) {
    runBlocking {
        (1..3).asSequence()
            .forEach { value -> println("$value") }
    }

    simple().forEach { value -> println("value: $value") }
}